
import { MongooseFactory } from "../kalend";
import { Schema } from "mongoose";

/** 邀请记录 */
const schema = MongooseFactory.Schema({
    // 被邀请人
    customerid:{
        type: Schema.Types.ObjectId,
        ref: "customer_account"
    },
    // 邀请人
    inviter: {
        type: Schema.Types.ObjectId,
        ref: "customer_account"
    },
    // 商户
    merchantid: {
        type: Schema.Types.ObjectId,
        ref: "merchant"
    },
    // 所属商户负责人ID
    legaluserid: {
        type: Schema.Types.ObjectId,
        ref: "platform_user"
    },
    //所属品牌宣传大使
    agent: {
        type: Schema.Types.ObjectId,
        ref: "platform_user"
    },
    //所属品牌宣传大使-邀请等级
    agentlevel: {
        type: Number
    },
    // 被邀请人是否充值会员
    isupvip:{
        type: Boolean,
        default: false
    },
    // 被邀请人充值会员金额
    upmoney:{
        type: Number
    },
    // 邀请人是否赠送餐币
    isgive:{
        type: Boolean,
        default: false
    },
    // 邀请人赠送餐币数量
    mealbalance:{
        type: Number
    },
    //备注
    remark: {
        type: String
    }
});



export const invitationModel = MongooseFactory.Model("invitation", schema);